<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()

const props = defineProps({
    url: {
        type: String,
        default: '/'
    },
    title: {
        type: String,
        default: 'YourLife'
    },
    icon: {
        type: String,
        default: 'icon-jiantouyou'
    }
})

const go = () => {
    router.push(props.url)
}
</script>

<template>
  <div class="card-container">
    <div class="card-top" @click="go">
      <div class="card-title">
        {{ props.title }}
      </div>
      <div class="card-icon">
        <i class="iconfont" :class="$props.icon"></i>
      </div>
    </div>
    <div class="card-detail">
        <slot name="detail">
            
        </slot>
    </div>
  </div>
</template>

<style lang="less" scoped>
.card-container {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    cursor: pointer;
    .card-top {
        width: 100%;
        height: 50px;
        line-height: 50px;
        font-weight: 700;
        /* color: #fff;
        background-color: #000; */
        display: flex;
        justify-content: space-between;
    }
    .card-title {
        font-size: 18px;
    }
    .card-icon i {
        color: #333;
        transition: all .3s ease;
    }
    .card-content {
        width: 100%;
        height: 100%;
    }
}

.card-top:hover i {
    color: #FF0336;
}
</style>
